﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucListEmail.ascx.cs" Inherits="Admin_UserControl_ucListEmail" %>
<h3 style="color: Red">
    Add New Email</h3>
    <table width="100%">
        <tr><td>
        <asp:Label ID="lblMessage" style="color:Red" runat="server"></asp:Label>
        </td>
            <td colspan="3">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtEmailAddress"
                    runat="server" ErrorMessage="email not null" SetFocusOnError="True" Display="Static"
                    ValidationGroup="grpRegister"></asp:RequiredFieldValidator>&nbsp;<br />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Invalid email address"
                    Display="Static" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                    ControlToValidate="txtEmailAddress" SetFocusOnError="True" ValidationGroup="grpRegister"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>
                Email Address
            </td>
            <td>
                <asp:TextBox ID="txtEmailAddress" ValidationGroup="grpRegister" runat="server"></asp:TextBox><br />
            </td>
            <td>
                Price
            </td>
            <td>
                <asp:TextBox ID="txtPrice" Text="0" runat="server"></asp:TextBox>
            </td>
            <td>
                Notes
            </td>
            <td>
                <asp:TextBox ID="txtNotes" TextMode="MultiLine" Height="20px" Width="90%" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:Button ID="btnSaveNew" runat="server" ValidationGroup="grpRegister" Text="Save" OnClick="btnSaveNew_Click" />
            </td>
        </tr>
    </table>
    <br />
    <asp:DataList ID="DataList1" runat="server" OnItemCommand="DataList1_ItemCommand"
        OnItemDataBound="DataList1_ItemDataBound" RepeatDirection="Horizontal">
        <SeparatorTemplate>
            | &nbsp;
        </SeparatorTemplate>
        <ItemTemplate>
            <asp:LinkButton ID="lnkbtnPaging" runat="server" CommandArgument='<%# Bind("PageIndex") %>'
                Text='<%# Bind("PageText") %>'></asp:LinkButton>
        </ItemTemplate>
    </asp:DataList>
    <br />

    <script type="text/javascript">
        function s() {
            var t = document.getElementById("<%=grdListEmail.ClientID%>");
            var t2 = t.cloneNode(true)
            for (i = t2.rows.length - 1; i > 0; i--)
                t2.deleteRow(i)
            t.deleteRow(0)
            a.appendChild(t2)
        }
        window.onload = s
    </script>

    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <div id="a">
                </div>
                <div style="overflow-y: scroll; height: 360px">
                    <asp:GridView ID="grdListEmail" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                        EmptyDataText="Not Found Email" AllowSorting="True" CssClass="yui" Width="100%"
                        OnPageIndexChanging="grdListEmail_PageIndexChanging" OnSorting="grdListEmail_Sorting"
                        OnRowDataBound="grdListEmail_RowDataBound">
                        <Columns>
                            <asp:BoundField DataField="IDEmail" HeaderText="ID" SortExpression="IDEmail">
                                <HeaderStyle ForeColor="White" />
                            </asp:BoundField>
                            <asp:HyperLinkField DataTextField="EmailAddress" HeaderText="Email Address" SortExpression="EmailAddress">
                                <HeaderStyle Width="10%" ForeColor="White" />
                                <ItemStyle Width="20%" />
                            </asp:HyperLinkField>
                            <%--<asp:BoundField DataField="status" HeaderText="Status" SortExpression="status" />--%>
                            <asp:BoundField DataField="Price" HeaderText="Price / 6 Month" SortExpression="Price">
                                <HeaderStyle Width="20%" ForeColor="White" />
                                <ItemStyle Width="20%" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="Notes">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtNotes" TextMode="MultiLine" Width="84%" Height="20px" runat="server"></asp:TextBox>
                                    <asp:CheckBox ID="ckEnable" runat="server" OnCheckedChanged="ckEnable_CheckedChanged"
                                        AutoPostBack="true" />
                                    <asp:ImageButton ID="btnSave" runat="server" ToolTip="Save" CommandName="Delete"
                                        OnClick="btnSave_Click" CommandArgument='<%# Eval("IDEmail") %>' ImageUrl="~/Admin/img/ic-save.png" />
                                </ItemTemplate>
                                <HeaderStyle Width="65%" ForeColor="White" />
                                <ItemStyle HorizontalAlign="Center" Width="65%" />
                            </asp:TemplateField>
                        </Columns>
                        <HeaderStyle CssClass="clsGrdHeader" />
                        <RowStyle CssClass="clsGrdRow" />
                        <AlternatingRowStyle CssClass="clsGrdAlternateRow" />
                        <PagerStyle CssClass="clsPage" />
                    </asp:GridView>
                </div>
            </td>
        </tr>
    </table>
